using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.CompositeUI.SmartParts;
using System.Windows.Forms;
using Microsoft.Practices.CompositeUI.WinForms;
using Microsoft.Practices.CompositeUI.Utility;
using Microsoft.Practices.CompositeUI.WPF;
using Jbe.CABExtension.SmartPartInfos;
using Microsoft.Practices.CompositeUI;
using Jbe.CABExtension.WinForms.Workspaces;

namespace Jbe.CABExtension.WPF.Workspaces
{
    /// <summary>
    /// Extends the FormWorkspace class with the support for hosting of WPF controls.
    /// </summary>
    public class FormWorkspace : Jbe.CABExtension.WinForms.Workspaces.FormWorkspace
    {
        private ElementHostWorkspaceComposerAdapter<Control, FormSmartPartInfo> composer;

        [ServiceDependency]
        public IWPFUIElementAdapter WPFUIElementAdapter
        {
            set { composer.WPFUIElementAdapter = value; }
        }

        public FormWorkspace() : base() { }

        public FormWorkspace(IWin32Window owner) : base(owner) { }

        protected override IWorkspaceComposer<Control> CreateWorkspaceComposer()
        {
            composer = new ElementHostWorkspaceComposerAdapter<Control, FormSmartPartInfo>(this);
            return composer;
        }
    }
}
